<template>
	<view style="background: #F8F8F8;height: 100vh;">
		<view class="user-content" v-if="userinfo">
			<view class="list-box">
				<view class="list-item">
					<view class="item-left">姓名</view>
					<view class="item-right">{{ userinfo.nickname }}</view>
				</view>
				<view class="list-item">
					<view class="item-left">手机号</view>
					<view class="item-right">{{ userinfo.mobile }}</view>
				</view>
				<view class="list-item">
					<view class="item-left">用户ID</view>
					<view class="item-right">{{ userinfo.id }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '@/api/index2.js';
	export default {
		data() {
			return {
				userinfo: null
			};
		},
		onLoad() {
			this.getUserInfo()
		},
		methods: {
			getUserInfo() {
				api.getUserInfo().then(res => {
					let info = res.data;
					if (info) {
						uni.setStorageSync('userinfo', info);
						this.$store.commit('saveUserInfo', info)
						this.userinfo = info;
					}
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
	.user-content {
		background: url('../../static/images/user/account-bg.png') no-repeat;
		background-size: 100% 104px;
		padding-bottom: 100rpx;
		padding-top: 22rpx;

		.list-box {
			margin: 0 28rpx;
			background: url('../../static/images/home/empty-bg.png') no-repeat;
			background-size: 100% 100%;
			padding: 52rpx 42rpx;

			.list-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 80rpx;
				margin-bottom: 20rpx;
				border-bottom: 2rpx solid #d3ebff;

				.item-left {
					font-family: SourceHanSansSC, SourceHanSansSC;
					font-weight: 400;
					font-size: 28rpx;
					color: #737373;
					line-height: 40rpx;
					font-style: normal;
				}

				.item-right {
					font-family: SourceHanSansSC, SourceHanSansSC;
					font-weight: 400;
					font-size: 28rpx;
					color: #000000;
					line-height: 40rpx;
					font-style: normal;
				}
			}
		}
	}
</style>